@echo off

REM =====================================================================
REM 
REM   File:      InstallProvider.cmd
REM   Summary:   Script to execute the SQL Remote Blob Storage provider 
REM              installation utility.
REM              Defaults to installing the provided File Store Provider
REM              and setting it to be the default provider.
REM   Date:      June 30th, 2008

REM ---------------------------------------------------------------------

REM   This file is part of the Microsoft SQL Server Code Samples.
REM   Copyright (C) Microsoft Corporation.  All rights reserved.

REM This source code is intended only as a supplement to Microsoft
REM Development Tools and/or on-line documentation.  See these other
REM materials for detailed information regarding Microsoft code samples.

REM THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
REM KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
REM IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
REM PARTICULAR PURPOSE.

REM ======================================================= */

set RootDir=%~dp0

REM Sets the name of the provider in the RBS instance. This must be unique 
REM for each provider instance registered with RBS, however multiple store 
REM registrations can use the same provider library with different 
REM configuration options.
set ProviderName=FileStoreProvider_1

REM This is the location of the provider library file. This will be used 
REM to locate and load the assembly on the local machine during RBS Client
REM initialization.
set FileStoreProviderLocation=%RootDir%

REM This is the location that will be used to store blobs. For the File Store 
REM provider, this is a directory that will be managed by the provider library.
REM For other types of providers, ie. EMC or other CAS solutions, this would
REM be the network location of the box.
REM For the File Store provider this may be a local or UNC path. Permissions 
REM may need to be set using the administrative stored procedures to allow this.
set DataLocation=%temp%\RBSFileStoreData\

REM This is the database server name used to create the connection string for 
REM the server connection. Can also include an instance name in the form 
REM ServerName\InstanceName.
set ServerName=(local)

REM This is the catalog/database name used to create the connection string for 
REM the server connection. This database must have had RBS installed using the 
REM MSI or stored procedure.
set DatabaseName=RemoteBlobStorage

echo ------------------------------------- 
echo Registering File Store Provider
echo SQL Server Instance: %ServerName%
echo Database: %DatabaseName%
echo File Store Library Binary Location: %FileStoreProviderLocation%
echo ProviderName: %ProviderName%
echo Data Location: %DataLocation%
echo.
"%RootDir%InstallProvider.exe" -server %ServerName% -database %DatabaseName% -configurationfile "%RootDir%FileProviderConfiguration.xml" -registrationfile "%RootDir%RegisterFileBlobStore.sql" -name %ProviderName% -substitution @LOCATION@ "%DataLocation% " -substitution @CAPACITY@ 5 -substitution @ProviderDir@ "%FileStoreProviderLocation% "




